import { loadEnv } from "vite";
import vue from '@vitejs/plugin-vue'
import path from "path";


export default ({ command, mode }) => {
  const isBuild = command == "build";
  const root = process.cwd();
  const env = loadEnv(mode, root);

  return {
    plugins: [vue()],
    resolve: {
      alias: {
        "@": path.resolve(__dirname, "src"),
      },
    },
    server: {
      allowedHosts : true,
      host: true,
      port: 5173,
      open: true,
      proxy: {
        "/api": {
          target: env.VITE_API_URL,
          changeOrigin: true,
        },
      },
    },
  };
};

// https://vite.dev/config/
// export default defineConfig({
//   plugins: [vue()],
// })
